import { request } from 'umi';

/** 获取商品列表 */
export async function getGoodsLists(options) {
  return request('/api/admin/product', {
    method: 'GET',
    params:options
  });
}



/** 获取商品列表头部标签及数量 */
export async function getGoodsTops(data) {
  return request('/api/admin/product/get_header', {
    method: 'POST',
    data
  });
}





/** 商品 上架 下架 */
export async function setGoodsPutAway(data) {
  return request('/api/admin/product/status', {
    method: 'PUT',
    data
  });
}

/** 商品规格 */
export async function getGoodsStandard(params) {
  return request('/api/admin/product_rule', {
    method: 'GET',
    params
  });
}

/** 规格模板删除 */
export async function delGoodsStandard(params) {
  return request('/api/admin/product_rule', {
    method: 'DELETE',
    params
  });
}

/** 规格模板添加 */
export async function addGoodsStandard(data) {
  return request('/api/admin/product_rule', {
    method: 'POST',
    data
  });
}


/** 规格详情 */
export async function getGoodsDetails(id,params) {
  return request(`/api/admin/product_rule/${id}`, {
    method: 'GET',
    params
  });
}


/** 规格模板修改 */
export async function changeGoodsStandard(id,data) {
  return request(`/api/admin/product_rule/${id}`, {
    method: 'PATCH',
    data
  });
}


/** 商品分类列表 */
export async function getGoodsCategory(params) {
  return request(`/api/admin/product_category`, {
    method: 'GET',
    params
  });
}


/** 商品分类修改 */
export async function changeGoodsCategory(id,data) {
  return request(`/api/admin/product_category/${id}`, {
    method: 'PATCH',
    data
  });
}

/** 商品分类状态修改 */
export async function setGoodsStatus(data) {
  return request(`/api/admin/product_category/status`, {
    method: 'PUT',
    data
  });
}


/** 商品分类删除 */
export async function delGoodsCategory(id,params) {
  return request(`/api/admin/product_category/${id}`, {
    method: 'DELETE',
    params
  });
}

/** 商品分类详情 */
export async function getGoodDetails(id,params) {
  return request(`/api/admin/product_category/${id}`, {
    method: 'GET',
    params
  });
}

/** 商品分类修改 */
export async function changeGoodDetails(id,params) {
  return request(`/api/admin/product_category/${id}`, {
    method: 'PATCH',
    params
  });
}


/** 商品评论列表 */
export async function getGoodsComment(params) {
  return request(`/api/admin/product_reply`, {
    method: 'GET',
    params
  });
}

/** 商品评论删除 */
export async function delGoodsComments(id,params) {
  return request(`/api/admin/product_reply/${id}`, {
    method: 'DELETE',
    params
  });
}

/** 商品评论回复 */
export async function replyGoodsComments(id,data) {
  return request(`/api/admin/product_reply/${id}`, {
    method: 'PATCH',
    data
  });
}
